package com.bolun998300.personal_blog_springboot.controller.background;


import com.bolun998300.personal_blog_springboot.pojo.Blogger;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller()
@RequestMapping("/background")
public class BackgroundSkipPageController {
	
    @GetMapping(value="")
    public String index1(){
    	
    	Subject subject = SecurityUtils.getSubject();
    	Blogger blogger = (Blogger)subject.getSession().getAttribute("user");
    	if(subject.isAuthenticated()&&blogger!=null) {
    		return "redirect:/background/index";
    	}
        return "redirect:/background/login";
    }
    
    @GetMapping("/login")
    public String login() {
    	return "/background/login";
    }
    
    @GetMapping(value = "/index")
    public String index(){
            return  "/background/index";
    }

    @GetMapping(value = "/main")
    public String main(){
        return "/background/main";
    }

    @GetMapping(value = "/newsList")
    public String newsList(){
        return "/background/newsList";
    }

    @GetMapping(value = "/newsAdd")
    public String newsAdd(){
        return "/background/newsAdd";
    }

    @GetMapping(value = "/typeManager")
    public String typeManager(){
        return "/background/typeManager";
    }

    @GetMapping(value = "/typeAdd")
    public String typeAdd(){
        return "/background/typeAdd";
    }

    @GetMapping(value = "/commentList")
    public String commentList(){
        return "/background/commentList";
    }

    @GetMapping(value = "/commentReview")
    public String commentReview(){
        return "/background/commentReview";
    }
    
    @GetMapping(value="/userInfoManager")
    public String userInfoManager() {
    	return "/background/userInfoManager";
    }
    
    @GetMapping(value="/userPasswordUpdate")
    public String userPasswordUpdate() {
    	return "/background/userPasswordUpdate";
    }

    @GetMapping(value="/basicParameter")
    public String basicParameter(){
        return "/background/basicParameter";
    }
    
    @GetMapping(value="/linksList")
    public String link() {
    	return "/background/linksList";
    }
    
    @GetMapping("/linksAdd")
    public String linkAdd() {
    	return "/background/linksAdd";
    }

    @GetMapping("/doLogout")
    public String dologout(){
        Subject subject = SecurityUtils.getSubject();
        subject.logout();
        return "redirect:/background/login";
    }
    
    @GetMapping("/recycleManager")
    public String recycleManager() {
    	return "/background/recycleManager";
    }
    @GetMapping("/draftManager")
    public String draftManager() {
    	return "/background/draftManager";
    }
    
    @GetMapping("/bbsList")
    public String bbsList() {
    	return "/background/bbsList";
    }
    
    @GetMapping("/bbsReview")
    public String bbsReview() {
    	return "/background/bbsReview";
    }

    @GetMapping("/recentUpdateList")
    public String recentUpdateList(){
        return "/background/recentUpdateList";
    }

    @GetMapping("/recentUpdateAdd")
    public String recentUpdateAdd(){
        return "/background/recentUpdateAdd";
    }

}
